package com.chartboost.sdk.impl;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.RectF;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.view.View;
import com.chartboost.sdk.Chartboost;
import com.chartboost.sdk.Libraries.CBOrientation.Difference;
import java.lang.reflect.Method;

public class u extends View
{
  private Handler a;
  private float b;
  private long c;
  private Paint d;
  private Paint e;
  private Path f;
  private Path g;
  private RectF h;
  private RectF i;
  private Bitmap j = null;
  private Canvas k = null;
  private Runnable l = new Runnable()
  {
    public void run()
    {
      CBOrientation.Difference localDifference = Chartboost.sharedChartboost().getForcedOrientationDifference();
      float f1 = u.this.getContext().getResources().getDisplayMetrics().density;
      u localu1 = u.this;
      u.a(localu1, u.a(localu1) + 1.0F * f1);
      if (localDifference.isOdd());
      for (int i = u.this.getWidth(); ; i = u.this.getHeight())
      {
        float f2 = i - f1 * 9.0F;
        if (u.a(u.this) > f2)
        {
          u localu2 = u.this;
          u.a(localu2, u.a(localu2) - f2 * 2.0F);
        }
        if (u.this.getWindowVisibility() == 0)
          u.this.invalidate();
        return;
      }
    }
  };

  public u(Context paramContext)
  {
    super(paramContext);
    a(paramContext);
  }

  private void a(Context paramContext)
  {
    float f1 = paramContext.getResources().getDisplayMetrics().density;
    this.b = 0.0F;
    this.a = new Handler();
    this.c = (()(System.nanoTime() / 1000000.0D));
    this.d = new Paint();
    this.d.setColor(-1);
    this.d.setStyle(Paint.Style.STROKE);
    this.d.setStrokeWidth(f1 * 3.0F);
    this.d.setAntiAlias(true);
    this.e = new Paint();
    this.e.setColor(-1);
    this.e.setStyle(Paint.Style.FILL);
    this.e.setAntiAlias(true);
    this.f = new Path();
    this.g = new Path();
    this.i = new RectF();
    this.h = new RectF();
    try
    {
      Class localClass = getClass();
      Class[] arrayOfClass = new Class[2];
      arrayOfClass[0] = Integer.TYPE;
      arrayOfClass[1] = Paint.class;
      Method localMethod = localClass.getMethod("setLayerType", arrayOfClass);
      Object[] arrayOfObject = new Object[2];
      arrayOfObject[0] = Integer.valueOf(1);
      localMethod.invoke(this, arrayOfObject);
      return;
    }
    catch (Exception localException)
    {
    }
  }

  protected void onAttachedToWindow()
  {
    this.a.removeCallbacks(this.l);
    this.a.post(this.l);
  }

  protected void onDetachedFromWindow()
  {
    this.a.removeCallbacks(this.l);
    if ((this.j != null) && (!this.j.isRecycled()))
      this.j.recycle();
    this.j = null;
  }

  protected void onDraw(Canvas paramCanvas)
  {
    float f1 = getContext().getResources().getDisplayMetrics().density;
    if ((this.j == null) || (this.j.getWidth() != paramCanvas.getWidth()) || (this.j.getHeight() != paramCanvas.getHeight()))
    {
      if ((this.j != null) && (!this.j.isRecycled()))
        this.j.recycle();
      this.j = Bitmap.createBitmap(paramCanvas.getWidth(), paramCanvas.getHeight(), Bitmap.Config.ARGB_8888);
      this.k = new Canvas(this.j);
    }
    this.j.eraseColor(0);
    Canvas localCanvas = this.k;
    CBOrientation.Difference localDifference = Chartboost.sharedChartboost().getForcedOrientationDifference();
    localCanvas.save();
    if (localDifference.isReverse())
      localCanvas.rotate(180.0F, getWidth() / 2.0F, getHeight() / 2.0F);
    this.h.set(0.0F, 0.0F, getWidth(), getHeight());
    this.h.inset(1.5F * f1, 1.5F * f1);
    int m;
    float f3;
    label274: float f5;
    label322: label380: float f6;
    float f7;
    if (localDifference.isOdd())
    {
      m = getWidth();
      float f2 = m / 2.0F;
      localCanvas.drawRoundRect(this.h, f2, f2, this.d);
      this.i.set(this.h);
      this.i.inset(3.0F * f1, f1 * 3.0F);
      if (!localDifference.isOdd())
        break label521;
      f3 = this.i.width();
      float f4 = f3 / 2.0F;
      this.f.reset();
      this.f.addRoundRect(this.i, f4, f4, Path.Direction.CW);
      if (!localDifference.isOdd())
        break label533;
      f5 = this.i.width();
      this.g.reset();
      if (!localDifference.isOdd())
        break label545;
      this.g.moveTo(f5, 0.0F);
      this.g.lineTo(f5, f5);
      this.g.lineTo(0.0F, f5 * 2.0F);
      this.g.lineTo(0.0F, f5);
      this.g.close();
      localCanvas.save();
      localCanvas.clipPath(this.f);
      f6 = -f5 + this.b;
      if (!localDifference.isOdd())
        break label697;
      f7 = this.i.height();
      label428: if (f6 < f7 + f5)
        break label591;
      localCanvas.restore();
      localCanvas.restore();
      if (paramCanvas == null)
        break label709;
      paramCanvas.drawBitmap(this.j, 0.0F, 0.0F, null);
    }
    label521: label533: label545: label681: label697: label709: 
    while (true)
    {
      long l1 = Math.max(0L, 16L - (()(System.nanoTime() / 1000000.0D) - this.c));
      this.a.removeCallbacks(this.l);
      this.a.postDelayed(this.l, l1);
      return;
      m = getHeight();
      break;
      f3 = this.i.height();
      break label274;
      f5 = this.i.height();
      break label322;
      this.g.moveTo(0.0F, f5);
      this.g.lineTo(f5, f5);
      this.g.lineTo(f5 * 2.0F, 0.0F);
      this.g.lineTo(f5, 0.0F);
      break label380;
      label591: float f8;
      label608: float f9;
      if (localDifference.isOdd())
      {
        f8 = this.i.top;
        f9 = f8 + f6;
        localCanvas.save();
        if (!localDifference.isOdd())
          break label681;
        localCanvas.translate(this.i.left, f9);
      }
      while (true)
      {
        localCanvas.drawPath(this.g, this.e);
        localCanvas.restore();
        f6 += 2.0F * f5;
        break;
        f8 = this.i.left;
        break label608;
        localCanvas.translate(f9, this.i.top);
      }
      f7 = this.i.width();
      break label428;
    }
  }

  protected void onWindowVisibilityChanged(int paramInt)
  {
    super.onWindowVisibilityChanged(paramInt);
    this.a.removeCallbacks(this.l);
    if (paramInt == 0)
      this.a.post(this.l);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.chartboost.sdk.impl.u
 * JD-Core Version:    0.6.2
 */